package liwen.zhao.controller;

import liwen.zhao.common.jd.pojo.Article;
import liwen.zhao.common.jd.vo.SysResult;
import liwen.zhao.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
public class ArticleController {
    @Autowired
    SysResult sysResult;
    @Autowired
    ArticleService articleService;
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public SysResult add(Article article){
        return articleService.addArticle(article);
    }
    
    @RequestMapping(method = RequestMethod.GET)
    public SysResult getArticleById(String id){
        return articleService.getArticleById(id);
    }
    
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public SysResult getArticleList(int page){
        return articleService.getArticleList(page);
    }
}
